package cn.ming.leo.resource.manager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import cn.ming.leo.bean.DoorTools;
import cn.ming.leo.bean.vo.RequestJson;
import cn.ming.leo.service.DoorToolsService;
import cn.ming.leo.service.ToolsService;
import cn.ming.leo.utils.Message;
import cn.ming.leo.utils.PageListModel;

@RestController
@RequestMapping("/m/door_tools")
public class MDoorToolsResource {

	@Autowired
	private DoorToolsService doorToolsService;
	@Autowired
	private ToolsService toolsService;

	@RequestMapping(value = "/findAll", method = RequestMethod.GET)
	public Message<PageListModel<DoorTools>> findAll(Integer toolsId, Integer pageIndex, Integer pageSize) {
		return doorToolsService.findAll(toolsId, pageIndex, pageSize);
	}

	@RequestMapping(value = "/updateRepair", method = RequestMethod.POST)
	@ResponseBody
	public Message<String> updateRepair(@RequestBody RequestJson json) {
		return toolsService.updateStatus(json.getId(), json.getStatus());
	}

	@RequestMapping(value = "/repairs", method = RequestMethod.GET)
	public Message<PageListModel<DoorTools>> repairs(Integer pageIndex, Integer pageSize) {
		return doorToolsService.reparis(pageIndex, pageSize);
	}

//	@RequestMapping(value = "/productDoors", method = RequestMethod.GET)
//	public Message<String> productDoors(@RequestBody RedisProductBean json) {
//		return doorToolsService.productDoors(json);
//	}

}
